﻿var status = -1;
var questions = Array(
	Array("爱好旅游（打一成语）","喜出望外"),
	Array("盲人摸象（打一成语）","不识大体"),
	Array("蜜饯黄连（打一成语）","同甘共苦"),
	Array("会计（打一成语）","足智多谋"),
	Array("逆水划船（打一成语","力争上游"),
	Array("快刀斩乱麻（打一成语","迎刃而解"), 
	Array("翘翘板（打一成语）","此起彼落"),
	Array("遇事不求人（打一成语）","自力更生"),
	Array("脱粒机（打一成语）","吞吞吐吐"),
	Array("四通八达（打一成语）","头头是道"),
	Array("一块变九块（打一成语）","四分五裂"),
	Array("节日的焰火（打一成语）","五彩缤纷"),
	Array("乖（打一成语）","乘人不备"),
	Array("相声（打一成语）","装腔作势"),
	Array("逆水划船（打一成语）","激流勇进"),
	Array("伞兵（打一成语）","从天而降"),
	Array("兔子请老虎（打一成语）","寅吃卯粮"),
	Array("照相底片","颠倒黑白"),
	Array("平原门下客三千","胜友如云"),
	Array("桁héng（打一成语）","行将就木"),
	Array("圆寂（打一成语）","坐以待毙"),
	Array("哑巴打手势（打一成语）","不言而喻"),
	Array("仙乐（打一成语）","不同凡响"),
	Array("零存整取（打一成语）","积少成多"),
	Array("初一（打一成语）","日新月异"),
	Array("暗中下围棋（打一成语）","皂白不分"),
	Array("并重（打一成语）","恰如其分"),
	Array("八十八（打一成语）","入木三分"),
	Array("超好牙刷（打一成语）","一毛不拔"),
	Array("打边鼓（打一成语）","旁敲侧击"), 
	Array("感冒通（打一成语）","有伤风化"),
	Array("鲁达当和尚（打一成语）","半路出家"),
	Array("皇（打一成语）","白玉无暇"),
	Array("举重比赛（打一成语）","斤斤计较"),
	Array("纸老虎（打一成语）","外强中干"),
	Array("美梦（打一成语）","好景不长"),
	Array("农产品（打一成语）","土生土长"),
	Array("无底洞（打一成语）","深不可测"),
	Array("早不说晚不说（打一字）","许"),
	Array("壹加壹（打一字）","王"),
	Array("上下一体（打一字）","卡"),
	Array("半导体（打一字）","付"),
	Array("熙熙攘攘（打一字）","侈"),
	Array("内里有人（打一字）","肉"),
	Array("入史册（打一字）","更"),
	Array("两点天上来（打一字）","关"),
	Array("祝福（打一字）","诘"),
	Array("池塘亮底（打一字）","汗"),
	Array("雨（打一字）","池"),
	Array("血盆（打一字）","唬"),
	Array("刃（打一字）","召"),
	Array("思（打一字）","十"),
	Array("武（打一字）","斐"),
	Array("书签（打一字）","颊"),
	Array("四个晚上（打一字）","罗"),
	Array("陕西人十分好（打一字）","附"),
	Array("送走观音使不得 （打一字）","还"),
	Array("入门无犬吠（打一字）","问"),
	Array("半耕半读（打一字）","讲"),
	Array("画中人（打一字）","佃"),
	Array("丰收（打一字）","移"),
	Array("弹丸之地（打一字）","尘"),
	Array("凤头虎尾（打一字）","几"),
	Array("矮（打一字）","射"),
	Array("抽水泵（打一字）","石"),
	Array("顶破天（打一字）","夫"),
	Array("后村闺中听风声（打一字）","封"),
	Array("另有变动（打一字）","加"),
	Array("山水之间，一方独立（打重庆一地名）","涪陵"),
	Array("掌声经久不息（打北京一地名）","延庆"),
	Array("沫若乡间住处（打北京一地名）","郭公庄"),
	Array("重点干起，秋前方成（打天津一地名）","和平"),
	Array("安得后羿弓","射阳"), 
	Array("雄踞山寨（打吉林一地名）","公主岭"),
	Array("潘仁美卖国","通辽"),
	Array("固若金汤（打河北一地名）","保定"), 
	Array("中国界首（打河北一地名）","玉田"),
	Array("金乌西坠白头看（河南地名）","洛阳"),
	Array("上下四方都无险（安徽地名）","六安"),
	Array("发扬大协作精神（青海地名）","互助"),
	Array("刘关张结义区（打台湾一地名）","桃园"),
	Array("又到鸡西市（黑龙江地名）","双城"),
	Array("庙建成菩萨到（打上海一地名）","静安寺"),
	Array("财源茂盛达三江（打广西一地名）","富川"),
	Array("情投意合（打宁夏一地名）","同心"),
	Array("公开赞助（打湖北一地名）","襄阳"),
	Array("公私仓廪皆丰实（打海南一地名）","屯昌"),
	Array("花和尚鲁智深（打四川一地名）","色达"),
	Array("刘邦登基诏书（打四川一地名）","宣汉"),
	Array("南人不复反矣（打四川一地名）","南充"),
	Array("举起鞭儿又紧缰（打新疆一地名）","策勒"),
	Array("介胄之士（打湖北一地名）","武汉"),
	Array("全面整顿（打云南一地名）","大理"),
	Array("美哉嘉陵（打云南一地名）","丽江"),
	Array("惩恶扬善（打云南一地名）","楚雄"),
	Array("山花红烂漫（打内蒙古一地名）","赤峰"),
	Array("恍然大悟（打一中草药名）","脑立清"),
	Array("十人九死（打一中药名）","独活"),
	Array("威风扫地(打一中草药名)","虎力散"),
	Array("低头思故乡（打一中草药名）","怀熟地"),
	Array("红十字会（打一中草药名）","九一丹"),
	Array("大开绿灯（打一中草药名）","路路通"),
	Array("三省吾身（打一中草药名）","防己"),
	Array("敲山震虎（打一中草药名）","驱风散"),
	Array("方法论（打一中草药名）","白术"),
	Array("滔滔不绝（打一中草药名）","长流水"),
	Array("久别重逢（打一中草药名）","一见喜"),
	Array("两个少女（打一中草药名）","二妙散"),
	Array("一江春水向东流（打一中草药名）","通大海"),
	Array("起宏图（打一中草药名）","远志"),
	Array("金钿遍野（打一中草药名）","地黄"),
	Array("踏花归来蝶绕膝（打一中草药名）","香附"),
	Array("第四季度经费（中草药名）","款冬花"),
	Array("妇女节前一天(打一中草药)","三七"),
	Array("人间四月芳菲尽(打一中草药)","春不见"),
	Array("滔滔不绝（打一中草药名）","长流水"),
	Array("偷梁换柱（打一中草药名）","木贼 "),
	Array("两横一竖（打一中草药名）","半夏"),
	Array("不知道（打一中草药名）","生地"),
	Array("窗前江水泛春色（打一中草药名）","空青"),
	Array("忠诚老实（中草药名）","厚朴"),
	Array("儿童节发假（打一中草药名）","六一散"),
	Array("古城姐妹（打一中草药名）","金银花"),
	Array("鲛人挥泪（打一中草药名）","珍珠散"),
	Array("老谋深算（打一中草药名）","苍术"),
	Array("六王毕，四海一（ 打《红楼梦》人名）","秦邦业"),
	Array("三八多面手（打《红楼梦》人名）","巧姐"),
	Array("女十八兮叹分离（打《红楼梦》人名）","杏奴"),
	Array("元前明后（打《水浒传》人名）","宋清"),
	Array("渐渐安定（打《水浒传》人名）","徐宁"),
	Array("赫赫小英雄（打《水浒传》人名）","童威"),
	Array("不许你发达（打《水浒传》人名）","杜兴"),
	Array("禁止调房（打《水浒传》人名）","杜迁"),
	Array("济人急难（打《水浒传》人名）","施恩"),
	Array("渐渐安定（打《水浒传》人名）","徐宁"),
	Array("众芳竞艳（打《水浒传》人名）","花荣"),
	Array("社会在发展（打《水浒传》人名）","史进"),
	Array("僧穿彩衣（打《水浒传》人物绰号）","花和尚"),
	Array("久旱逢甘露（打水浒传人物绰号）","及时雨"),
	Array("奥运射击冠军（打《水浒传》人物绰号）","金枪手"),
	Array("再三谦让（打《三国演义》人名）","陆逊"),
	Array("古代文化（打《三国演义》人名）","史迹"),
	Array("事事齐全说汉高（打《三国演义》人名）","刘备"),
	Array("逐渐繁荣（打《三国演义》人名）","徐盛"),
	Array("八骏日行三万里（打《三国演义》人名）","马良"), 
	Array("轻骑飞跃（打《三国演义》人名）","马超"),
	Array("天不绝曹（打《三国演义》人名）","魏续"),
	Array("汉朝文书（打《三国演义》人名）","刘表"),
	Array("醒后得知一场梦（打《西游记》人名）","悟空"),
	Array("相声逗乐（打《西游记》人物）","眼看喜"),
	Array("各一方话鼠（打一画家名）","吴道子"),
	Array("齐楚燕赵皆降服（打《史记》一句）","四国顺之"),
	Array("口道恒河沙复沙（打《史记》一句）","不可胜数"),
	Array("故（打《史记》一句）","总之不离古文者近是"),
	Array("坚持到底（打《史记》一句）","虽死不易"),
	Array("死而轻于鸿毛（打《史记》一句）","故无贵无贱"), 
	Array("好读书（打《论语》一句）","学而不厌"),
	Array("尖（打《论语》一句）","小大由之"),
	Array("莫中美人计（打《论语》一句）","戒之在色"),
	Array("退席（打《论语》一句）","不在其位"),
	Array("门外汉（打《论语》一句）","未入于室也"),
	Array("为储户保密（打《四书》一句）","慎言其余"),
	Array("洪湖歌声融暮色（打《滕王阁序》一句）","窜梁鸿于海曲"),
	Array("回归洛阳（打《前出师表》一句）","还于旧都"),
	Array("科举制度（打《前出师表》一句）","试用于昔日"),
	Array("人家在何处（打《前出师表》一句）","以咨诹善道"),
	Array("子游（打《聊斋志异》一篇名）","鼠戏"),
	Array("使女择焉（打《孟子》一句）","决汝汉"),
	Array("易之而教之（打《孟子》一句）","选宾为主"),
	Array("测鼠（打一词牌名）","卜算子"),
	Array("休得多言（打一文学名词）","歇后语"),
	Array("何谓状元（打一文学名词）","第一人称"),
	Array("平等待客（打一文学名词）","主人公"),
	Array("天女散花(打一新兴词语)","高消费"),
	Array("无可奈何花落去（打一常用词）","感谢"),
	Array("一把刀，顺水漂，有眼睛，没眉毛。（打一动物名）","鱼"),
	Array("两眼外秃大嘴巴，有个尾巴比身大，青草假山来相伴，绽放朵朵大红花","金鱼"),
	Array("像鱼不是鱼，终生住海里。远看是喷泉，近看像岛屿（打一动物名）","鲸"),
	Array("小时像豆号，在水中玩耍。长大跳得高，是捉虫冠军（打一动物名）","青蛙"),
	Array("为你打我，为我打你。打到你皮开，打得我出血（打一动物名）","蚊子"),
	Array("似鸟又非鸟，有翅身无毛，一脸丑模样，专爱夜遨游","蝙蝠"),
	Array("肥腿子，尖鼻子。穿裙子，背屋子（打一动物名）","梦想"),
	Array("身穿绿衣裳，肩扛两把刀。庄稼地里走，害虫吓得跑（打一动物名）","螳螂"),
	Array("娘子娘子，身似盒子。麒麟剪刀，八个钗子（打一动物名）","螃蟹"),
	Array("黑脸包丞相，坐在大堂上（打一动物）","蜘蛛"),
	Array("身小力不小，团结又勤劳。有时搬粮食，有时挖地道（打一动物名）","蚂蚁"),
	Array("白天一起玩，夜间一块眠，到老不分散，人间好姻缘（打一动物）","鸳鸯"),
	Array("个儿高又大，脖子似吊塔。和气又善良，从来不打架（打一动物名）","长颈鹿"),
	Array("脚儿小，腿儿高，戴红帽，穿白袍（打一动物名）","丹顶鹤"),
	Array("有位小姑娘，身穿黄衣裳。谁要欺负她，她就戳一枪（打一动物名）","马蜂"),
	Array("脚像细牛脚，身像大狗重。行象后生子，须象老大人（打一动物名）","羊"),
	Array("脚着暖底靴，口边山胡须。夜里当巡捕，日夜把眼眯（打一动物名）","猫"),
	Array("无脚也无手，身穿鸡皮皱。谁若碰着它，吓得连忙走（打一动物名）","蛇"),
	Array("身长约一丈，鼻生头顶上。背黑肚皮白，安家在海岸（打一动物名）","海豚"),
	Array("身上滑腻腻，喜欢钻河底。张嘴吐梦想，可以测天气（打一动物名）","泥鳅"),
	Array("姑娘真辛苦，晚上还织布。天色蒙蒙亮，机声才停止（打一动物名）","纺织娘"),
	Array("身子轻如燕，飞在天地间，不怕相隔远，也能把话传（打一动物名）","信鸽"),
	Array("吃进的是草，挤出的是宝。舍己为人类，功劳可不小（打一动物名）","奶牛"),
	Array("长胳膊，猴儿脸。大森林里玩得欢。摘野果，捣鹊蛋，抓住树枝荡秋千（打一动物名）","长臂猿"),
	Array("左手五个，左手五个。拿去十个，还剩十个（打一日常用品）","手套"),
	Array("四角方方，常随常往。伤风咳嗽，数它最忙（打一日常用品）","手帕"),
	Array("半个西瓜样，口朝上面搁。上头不怕水，下头不怕火（打一日常用品）","锅"),
	Array("中间是火山，四边是大海。海里宝贝多，快快捞上来（打一日常用品）","火锅"),
	Array("红娘子，上高楼，心里疼，眼泪流（打一日常用品名）","蜡烛"),
	Array("猛将百余人，无事不出城。出城就放火，引火自烧身（打一日常用品）","火柴"),
	Array("一只八宝袋，样样都能装。能装棉和纱，能装铁和钢（打一日常用品）"," 针线包"),
	Array("远看两个零，近看两个零。有人用了行不得，有人不用不得行（打一日常用品）","眼镜"),
	Array("有面无口，有脚无手。听人讲话，陪人吃酒（打一日常用品）","桌子"),
	Array("带着平顶帽，身穿圆筒袄，虽然一只眼，暗中逞英豪（打一日常用品）","手电筒"),
	Array("前面来只船，舵手在上边，来时下小雨，走后路已干（打一日常用品）","熨斗"),
	Array("小小东西，放在腋底。有病没病，看它肚皮（打一日常用品）","温度计"),
	Array("一只雀，飞上桌，捏尾巴，跳下河（打日常用品）","汤匙"),
	Array("鼻子朝天，嘴巴朝地。敲它一锤，惊天动地（打一日常用品）","大钟"),
	Array("金钩吊银圈，姐妹隔座山。若要来相会，需到天色晚（打一日常用品）","耳环"),
	Array("生在山崖，落在人家，凉水浇背，千刀万剐（打一日用品）","磨刀石"),
	Array("薄薄一张口，能啃硬骨头。吃肉不喝汤，吃瓜不嚼豆（打一日常用品）","菜刀"),
	Array("外面冷冰冰，里面热心肠，一夜到天亮，肚里还不凉（打一日常用品）","暖壶"),
	Array("有硬有软，有长有宽。白天空闲，夜晚上班（打一日常用品）","床"),
	Array("有风吹不动，它动就生风，若要不动它，待到起秋风（打一日常用品）","扇子"),
	Array("一间小药房，药品里面藏。房子涂白色，十字画中央（打一日常用品）","医药箱"),
	Array("一物生得巧，地位比人高。戴上御风寒，脱下有礼貌（打一日常用品）","帽子"),
	Array("一颗小红枣，一屋盛不了。只要一开门，枣儿往外跑 打一日常用品）","油灯"),
	Array("屋里一座亭，亭中有个人，天天荡秋千，不荡就有病（打一日常用品）","钟摆"),
	Array("不是点心不是糖,软软凉凉肚里藏,不能吃来不能喝,每天也要尝一尝（打一日常用品）","牙膏"),
	Array("红艳艳，飘胸前。像火苗，暖心间（打一日常用品）","红领巾"),
	Array("头上亮光光，出门就成双。背上缚绳子，驮人走四方（打一日常用品）","皮鞋"),
	Array("口比肚子大，给啥就吃啥。它吃为了你，你吃端着它（打一日常用品）","饭碗"),
	Array("楼台接楼台，一层一层接起来，上面冒白气，下面水开花（打一日常用品）","蒸笼"),
	Array("平日不思，中秋想你。有方有圆，又甜又蜜（打一日常用品）","月饼"),
	Array("一只黑鞋子，黑帮黑底子。挂破鞋子口，漏出白衬子（打一日常用品）","西瓜子")
);
var qid = -1;
var time1;
var time2;
var count = 0;
function start() {
    action(1, 0, 0);
}

function action(mode, type, selection) {
	if (mode == 1) {
		status++;
	} else {
		if (status >= 0) {
			cm.dispose();
			return;
		}
		status--;
	}
	if (status == 0) {
		var text = "猜灯谜，拿点卷\r\n";
		text+="#L0#活动规则#l\r\n";
		text+="#L1#开始答题#l\r\n";
		cm.sendSimple(text);
	} else if (status == 1) {
		if (selection == 0 && qid == -1) {
			cm.sendSimple("本活动每人可以参与10次，只要连续答对10道题就可以领取18888点卷。如果答错了就要重头再来哦！本活动每个账号只能参加一次。");
			status = -1;
		} else {
			time1 = cm.getCurrentTime();
			count++;
			qid = Math.floor(Math.random()*questions.length);
			cm.sendGetText("#r第 "+count+" 题#k\r\n#b#e"+questions[qid][0]+"#n#k\r\n请在30秒内作答");
		}
	} else if (status == 2) {
		if (cm.getPlayer().getTodayOnlineTime() < 240) {
			cm.sendOk("在线时间小于240分钟，无法参加该活动。");
			cm.dispose();
			return ;
		}
		if (cm.getBossLogAcc("2016灯谜")==-1) {
			cm.sendOk("本活动每账号只限参加一次，您已经参加过该活动了。");
			cm.dispose();
			return;
		}
		time2 = cm.getCurrentTime();
		var myasked = cm.getText();
		var answer = questions[qid][1];
		if ((time2-time1)/1000 > 30) {
			cm.sendOk("很遗憾，超过答题时间了。请重新作答。");
			cm.dispose();
			return;
		}
		if (myasked == answer) {
			status = 0;
			if (count<10) {
				cm.sendSimple("恭喜你回答正确，继续下一题吧！");
			} else {
				cm.setBossLogAcc("2015灯谜", -2);
				cm.sendOk("成功回答了10个问题！获得#r18888#k点卷");
				cm.gainNX(18888);
				cm.dispose();
			}
		} else {
			status = -1;
			count = 0;
			cm.sendSimple("真遗憾！#b"+questions[qid][0]+"#k的正确答案是：\r\n\——#r"+questions[qid][1]+"#k");
			qid = -1;
		}
	}
}
